/**  
 * @Title DiscountTypeEnum.java
 * @date 2016年4月26日 下午4:29:44
 * @Copyright (c) 2016, unibroad.com Inc. All rights reserved.
 */
package mt.model.enums;

/**
 * @Description 订单状态枚举
 * @Class mt.model.enums.DiscountTypeEnum
 * @author suan@unibroad.com
 * @version V1.0
 */
public enum OrderStatusEnum {

    WAIT_PAY(0, "待支付"),

    PAY_SUCCESS(1, "支付成功"),

    FUND_APPLY(2, "要求退款"),

    FUND_BACK(3, "已经退款"),

    TIMEOUT(4, "超时"),

    CANCEL(5, "已取消"),

    FINISHED(9, "已完结")

    ;

    /** 业务分类名称 */
    private int code;

    /** 业务分类描述 */
    private String description;

    /**
     * 构造函数
     * 
     * @param code
     * @param description
     */
    private OrderStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static OrderStatusEnum getEnumByCode(int code) {

        for (OrderStatusEnum tmpEnum : OrderStatusEnum.values()) {
            if (tmpEnum.getCode() == code) {
                return tmpEnum;
            }
        }

        return null;
    }

    /**
     * @return the code - {返回值描述信息}.
     */
    public int getCode() {
        return code;
    }

    /**
     * @param code
     *            - {参数含义描述}.
     */
    public void setCode(int code) {
        this.code = code;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description
     *            the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }
}
